package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.bizsys.mapper.ExtMonnifyOrderMapper;
import com.ruoyi.bizsys.domain.ExtMonnifyOrder;
import com.ruoyi.bizsys.service.IExtMonnifyOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * monnify订单Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class ExtMonnifyOrderServiceImpl extends ServiceImpl<ExtMonnifyOrderMapper,ExtMonnifyOrder> implements IExtMonnifyOrderService {

    /**
     * 查询monnify订单
     *
     * @param id monnify订单ID
     * @return monnify订单
     */
    @Override
    public ExtMonnifyOrder selectExtMonnifyOrderById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询monnify订单列表
     *
     * @param extMonnifyOrder monnify订单
     * @return monnify订单
     */
    @Override
    public List<ExtMonnifyOrder> selectExtMonnifyOrderList(ExtMonnifyOrder extMonnifyOrder) {
        return this.list(new QueryWrapper<>(extMonnifyOrder).last("order by id desc"));
    }

    /**
     * 新增monnify订单
     *
     * @param extMonnifyOrder monnify订单
     * @return 结果
     */
    @Override
    public int insertExtMonnifyOrder(ExtMonnifyOrder extMonnifyOrder) {
        extMonnifyOrder.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(extMonnifyOrder);
    }

    /**
     * 修改monnify订单
     *
     * @param extMonnifyOrder monnify订单
     * @return 结果
     */
    @Override
    public int updateExtMonnifyOrder(ExtMonnifyOrder extMonnifyOrder) {
        extMonnifyOrder.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(extMonnifyOrder);
    }

    /**
     * 批量删除monnify订单
     *
     * @param ids 需要删除的monnify订单ID
     * @return 结果
     */
    @Override
    public int deleteExtMonnifyOrderByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除monnify订单信息
     *
     * @param id monnify订单ID
     * @return 结果
     */
    @Override
    public int deleteExtMonnifyOrderById(Long id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public List<String> getListStringByCustNo(String custNo) {
        return baseMapper.getListStringByCustNo(custNo);
    }

}
